package test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.bcncoding.appengine.droiding.server.dao.ServiceProviderDao;
import org.bcncoding.appengine.droiding.server.entity.ServiceProvider;
import org.bcncoding.appengine.droiding.server.entity.SystemType;

public class PopulateServlet extends HttpServlet {

	private static final long serialVersionUID = -6405515129634460459L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		ServiceProviderDao dao = new ServiceProviderDao(ServiceProvider.class);
		for (int i = 0; i < 100; i++) {
			ServiceProvider sp = new ServiceProvider();
			sp.setName("name " + i);
			sp.setKey("key " + i);
			sp.setLocation("location " + i);
			sp.setType(SystemType.jcdecaux);
			sp.setZoomLevel(i);
			sp.setLatitude((double) i);
			sp.setLongitude((double) i);
			dao.save(sp);
		}
	}
}
